/*
 * \brief  Server-side de-marshaller of framebuffer session interface
 * \author Norman Feske
 * \date   2006-07-10
 */

/*
 * Copyright (C) 2006-2009 Norman Feske
 * Genode Labs, Feske & Helmuth Systementwicklung GbR
 *
 * This file is part of the Genode OS framework, which is distributed
 * under the terms of the GNU General Public License version 2.
 */

#ifndef _INCLUDE__FRAMEBUFFER_SESSION__SERVER_H_
#define _INCLUDE__FRAMEBUFFER_SESSION__SERVER_H_

#include <base/server.h>
#include <framebuffer_session/framebuffer_session.h>

namespace Framebuffer {

	class Session_server : public Genode::Server_object, public Session
	{
		public:

			int dispatch(int op, Genode::Ipc_istream &is, Genode::Ipc_ostream &os)
			{
				switch (op) {
				case DATASPACE:
					{
						os << dataspace();
						return 0;
					}
				case INFO:
					{
						int w = -1, h = -1;
						Mode mode = INVALID;
						info(&w, &h, &mode);
						os << w << h << mode;
						return 0;
					}
				case REFRESH:
					{
						int x = 0, y = 0, w = 0, h = 0;
						is >> x >> y >> w >> h;
						refresh(x, y, w, h);
						return 0;
					}
				}
				return -1;
			}
	};
}

#endif /* _INCLUDE__FRAMEBUFFER_SESSION__SERVER_H_ */
